package com.chencs.app.lianmeng.controller;

import com.alibaba.fastjson.JSON;
import com.chencs.app.lianmeng.service.LMCapitalSer;
import com.chencs.vo.net.lmrequest.LmPayAccountEditorRequest;
import com.chencs.vo.net.lmrequest.LmPayAccountRequest;
import com.chencs.vo.net.lmrequest.LmRegisterRequest;
import com.chencs.vo.net.lmrequest.LmWithdrawRequest;
import com.chencs.vo.net.lmresponse.LmPayAccountResponse;
import com.chencs.vo.net.lmresponse.LmRegisterResponse;
import com.chencs.vo.net.lmresponse.LmWithdrawResponse;
import com.chencs.vo.net.response.ResponseBase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/app/lmCapital")
public class LMCapitalCtr {
    /**
     * 资金相关
     */


    @Autowired
    private LMCapitalSer capitalSer;

    /**
     * 我的提现记录
     * @param request
     * @return
     */
    @RequestMapping(value = "/WithdrawList", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String WithdrawList(@RequestBody LmWithdrawRequest request){
        LmWithdrawResponse response = capitalSer.WithdrawList(request);
        return JSON.toJSONString(response);
    }


    /**
     * 提现
     * @param request
     * @return
     */
    @RequestMapping(value = "/createWithdraw", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String createWithdraw(@RequestBody LmWithdrawRequest request){
        ResponseBase response = capitalSer.createWithdraw(request);
        return JSON.toJSONString(response);
    }


    /**
     * 获取提现帐号
     * @param request
     * @return
     */
    @RequestMapping(value = "/getPayAccount", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getPayAccount(@RequestBody LmPayAccountRequest request){
        LmPayAccountResponse response = capitalSer.getPayAccount(request);
        return JSON.toJSONString(response);
    }

    /**
     * 添加支付宝
     * @param request
     * @return
     */
    @RequestMapping(value = "/createPayAccount", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String createPayAccount(@RequestBody LmPayAccountEditorRequest request){
        ResponseBase response = capitalSer.createPayAccount(request);
        return JSON.toJSONString(response);
    }

    /**
     * 修改支付宝信息
     * @param request
     * @return
     */
    @RequestMapping(value = "/editorPayAccount", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String editorPayAccount(@RequestBody LmPayAccountEditorRequest request){
        ResponseBase response = capitalSer.editorPayAccount(request);
        return JSON.toJSONString(response);
    }


}
